import core


func_obj_holder=[]

class pyfunc_obj(core.func_obj_wrapper):
    def do_get_type_name(self):
        return type(self).__name__

    def do_destroy(self):
        print "destroied"
        for i in range(0,len(func_obj_holder)):
            if func_obj_holder[i] is self:
         #       print 'Loaded model:',model_holder[i],'deleted'
                del func_obj_holder[i]
                break
            
    def do_clone(self):
        print "cloned"
        func_obj_holder.append(self)
        return self

class py_log_func_obj(pyfunc_obj):
    log_file=None
    def do_eval(self,p):
        if self.log_file is None:
            self.log_file=open('/tmp/a.log','w')
        for i in range(0,p.size()):
            self.log_file.write("%s "%(p[i]))
        self.log_file.write('\n')
        return self.do_eval1(p)

